import type { CSSProperties } from 'vue'

export type { GridProps } from './props'

export type InstanceState = {
  estimatedColumnWidth: number
  estimatedRowHeight: number
  lastMeasuredColumnIndex: number
  lastMeasuredRowIndex: number
  columnMetadataMap: Record<string, MetadataType>
  leftColumnMetadataMap: Record<string, MetadataType>
  rightColumnMetadataMap: Record<string, MetadataType>
  rowMetadataMap: Record<string, MetadataType>
}

export type SizeType = (index: number) => number
export type ScrollDirectionType = 'forward' | 'backward'

export type IndexType = {
  rowIndex: number
  columnIndex: number
}

export type MetadataType = {
  offset: number
  size: number
}

export type RowRendererParams = {
  rowIndex: number
  style: CSSProperties
  cells: JSX.Element[]
  key: string
  isHeader?: boolean
}

export type CellRendererParams = {
  columnIndex: number
  rowIndex: number
  style: CSSProperties
  key: string
}

export type CellSizeType = CellSizeGetter | number
export type CellSizeGetter = (index: number) => number
